/*
 * CloudBeaver - Cloud Database Manager
 * Copyright (C) 2020-2024 DBeaver Corp and others
 *
 * Licensed under the Apache License, Version 2.0.
 * you may not use this file except in compliance with the License.
 */
.menuPanelItem {
  composes: theme-ripple theme-border-color-background from global;

  flex: 1;
  display: flex;
  position: relative;
  align-items: center;
  width: 100%;
  height: 28px;
  padding: 0 4px;
  max-width: 420px;

  & .menuItemMain {
    width: 100%;
    display: flex;
    align-items: center;
  }

  & .menuItemText,
  & .menuItemBinding {
    display: block;
    padding: 0 4px;
  }
  & .menuItemBinding {
    flex: 1;
    text-align: right;
    padding-left: 32px;
    min-width: 80px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--theme-text-hint-on-light);

    &:empty {
      padding: 0;
    }
  }
  & .menuItemIcon,
  & .menuItemContent {
    width: 24px;
    height: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  & .menuItemContent .icon {
    width: 10px;
    height: 10px;
    opacity: 0.5;
  }
  & .iconOrImage {
    width: 16px;
    height: 16px;
    object-fit: contain;
  }
  & .loader {
    width: 16px;
  }

  & .menuItemText {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  & .menuItemIcon {
    flex-shrink: 0;
  }
}

.menuItemBinding {
  composes: theme-typography--caption from global;
}

.menuBox[data-s-has-bindings='false'] .menuItemBinding {
  min-width: 0;
}

.menuBox[dir='rtl'] {
  & .menuItemText {
    text-align: right;
  }
  & .menuItemContent .icon {
    transform: rotate(180deg);
  }
}

.menuItem:hover,
.menuItem:global([aria-expanded='true']) {
  & .menuItemContent .icon {
    opacity: 1;
  }
}
